package com.kdgc.springboot001.controller;


import com.kdgc.springboot001.ceshi.SpringUtil;
import com.kdgc.springboot001.javabean.Car;
import com.kdgc.springboot001.javabean.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Slf4j
@Controller
public class HelloController {

    @Autowired
    Car car ;


    @RequestMapping("/hello")
    @ResponseBody
    public String hello() {

        log.info("测试日志了>>>>>>>>>>>");

        return "hello springboot11122";

    }


    @RequestMapping("/getbean")
    @ResponseBody
    public String getbean() {

        /*测试 工具类  从容器中  获取  bean组件*/
        User user01 = SpringUtil.getBean("user01", User.class);
        System.out.println(user01);

        return "222222222";

    }


    /*测试 配置文件 数据绑定*/
    @RequestMapping("/car")
    @ResponseBody
    public Car car(){
        return  car;
    }

}
